package org.dtrd.modules.drug.entity.po;

import com.baomidou.mybatisplus.annotation.*;
import lombok.Getter;
import lombok.Setter;
import org.dtrd.modules.drug.entity.bean.DrugCategoryDetail;

import java.util.Date;


/**
 * <p>
 * 药品分类
 * </p>
 *
 * @author QR
 * @since 2021-12-02
 */
@Getter
@Setter
@TableName("dtrd_ext_ems_yw_drug_category")
public class DtrdExtEmsYwDrugCategory {

    @TableId(value = "data_id", type = IdType.AUTO)
    private Integer dataId;

    @TableField("is_del")
    @TableLogic
    private Integer isDel;

    /**
     * 分类名称
     */
    @TableField("category_name")
    private String categoryName;

    /**
     * 分类描述
     */
    @TableField("category_desc")
    private String categoryDesc;

    /**
     * 创建时间
     */
    @TableField("category_create_time")
    private Date categoryCreateTime;

    /**
     * 用药方式
     */
    @TableField("catagory_drug_direction")
    private Integer catagoryDrugDirection;

    @TableField("category_thumb")
    private String categoryThumb;

    /**
     * 父分类ID
     */
    @TableField("category_pid")
    private Integer categoryPid;

    public DtrdExtEmsYwDrugCategory init() {
        isDel = 0;
        categoryCreateTime = new Date();
        return this;
    }

    public DtrdExtEmsYwDrugCategory parseFromDto(DrugCategoryDetail dto) {
        dataId = dto.getDataId();
        categoryName = dto.getColumnName();
        categoryDesc = dto.getCategoryDesc();
        categoryCreateTime = dto.getCategoryCreateTime();
        catagoryDrugDirection = dto.getCatagoryDrugDirection();
        categoryThumb = dto.getCategoryThumb();
        categoryPid = dto.getCategoryId();
        return this;
    }


}
